/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ticketManager.controller;

import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import ticketManager.ejb.ProblemDAO;
import ticketManager.model.ManagerUser;
import ticketManager.model.Problem;

/**
 *
 * @author Administrator
 */
@ManagedBean
@ViewScoped
public class ListUserProblemsController {

    @EJB
    ProblemDAO pd;
    private List<Problem> problemsByProcess = new ArrayList<>();

    private List<Problem> temp = new ArrayList<>();

    public List<Problem> getTemp() {
        return temp;
    }

    public ListUserProblemsController() {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ManagerUser m = (ManagerUser) facesContext.getExternalContext().getSessionMap().get("user");
        problemsByProcess = pd.getProblemsByProcess(m);
        temp = problemsByProcess;
    }

    
    public String listProblemsByProcess() {
        System.out.println("eeee");
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ManagerUser m = (ManagerUser) facesContext.getExternalContext().getSessionMap().get("user");
        problemsByProcess = pd.getProblemsByProcess(m);
        temp = problemsByProcess;
        return "listProblemsByProcess";
    }

    public String changeURL() {
        System.out.println("aaaaaaaaaaa");
        return "changeStatusURL";
    }
}
